package com.appspot.categoryeditor.utils;

import javax.servlet.http.HttpServletRequest;

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

public final class UserUtils {
	public static boolean checkLogin(HttpServletRequest req) {
		return req.getUserPrincipal() != null;
	}
	
	public static String getLoginUserId(){
		UserService userService = UserServiceFactory.getUserService();
		User user = userService.getCurrentUser();
		if(user == null){
			return null;
		}
		return user.getNickname();
	}

	
}
